<template>
    <transition name="fade">
      <div class="mask-layer"  v-show="visible" @click="_emitHidden">
        <div class="alert-container" @click.stop>
          <div class="top border-1px">{{title}}</div>
          <div class="content border-1px">{{content}}</div>
          <div class="bottom" @click="_emitHidden">
            确定
          </div>
        </div>
      </div>
    </transition>
</template>

<script>
    export default {
        name: "alert",
        props:{
          title:{
            type:String,
            default(){
              return ''
            }
          },
          content:{
            type:String,
            default(){
              return ''
            }
          },
          visible:{
            type:Boolean,
            default(){
              return false
            }
          }
        },
        methods:{
          _emitHidden(){
            this.$emit('hidden',false)
          }
        }
    }
</script>

<style scoped lang="stylus">
  @import '../../common/stylus/mixin.styl'
  .mask-layer
    position absolute
    width 100%
    height 100%
    background rgba(0,0,0,.7)
    z-index 1000000
    text-align center
    &.fade-enter-active, &.fade-leave-active {
      transition: opacity .5s;
    }
    &.fade-enter, &.fade-leave-to {
      opacity: 0;
    }
    .alert-container
      position relative
      top 120px
      width calc(100% - 80px)
      margin 0 auto
      background #171718
      border-radius 3px
      overflow hidden
      .top
        height 44px
        color #ffffff
        line-height 44px
        font-size 16px
        border-1px(#525252)
      .content
        padding 10px 12px
        text-align left
        border-1px(#525252)
        min-height 80px
        font-size 14px
        line-height 17px
      .bottom
        height 44px
        background #f7c20f
        color #161719
        line-height 44px
        font-size 16px

</style>
